package com.job.didi;

/**
 * @author angzhijin
 * @Description
 * @create 2022-09-17 2:57 PM
 */
import java.util.*;
public class Didi0917 {

    public static void main(String[] args) {
A(args);
//B(args);
    }

    /**
     * ?12?0?8??
     *
     * 212101902
     */
    public static void A(String[] args) {
        Scanner sc = new Scanner(System.in);
        char[] line = sc.nextLine().toCharArray();
        int len = line.length;
        if(len<2){
            System.out.println(3);
            return;
        }
        int sum =0;
        int count = 0;
        for (char ch : line) {
            if (ch != '?') {
                sum += ch - '0';
            }else
                count++;
        }
        for (int i = 0; i < len; i++) {
            char cur = line[i];
            if(cur=='?'){
                if(count==1){
                    line[i] =(char)('0'+(3-sum%3)%3);
                    if(i==0){
                        line[i] =(char)('0'+(3-sum%3));
                    }
                    break;
                }
                if(i==0){
                    line[i] = line[i+1]=='1'?'2':'1';
                }else{
                    char prv = line[i-1];
                    char next = i+1<len?line[i+1]:'!';
                    // 这里有问题, 缺了补2的情况
                    if(prv=='0' && next !='1'){
                        line[i] = '1';
                    }else if(next=='0' && prv != '1'){
                        line[i] = '1';
                    }
                    else{
                        line[i] = '0';
                    }
                }
                count--;
                sum+= line[i]-'0';
            }
        }
        System.out.println(new String(line));
    }


    public static void B(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int p = sc.nextInt();
        int q = sc.nextInt();
        int[][] event = new int[3][n];
        for (int i = 0; i < 3; i++) {
            for (int j = 0; j < n; j++) {
                event[i][j] = sc.nextInt();
            }
        }

        Map<Integer, int[]> map =new HashMap<>();
        int count=0;
        for (int i = 0; i < n; i++) {
            int left = event[0][i];
            int right = event[1][i];
            int e = event[2][i];
            for (int j = left; j < right+1; j++) {
                int[] l = map.getOrDefault(j, new int[2]);
                if(e==1){
                    l[0]++;
                }else{
                    l[1]++;
                }
                map.put(j,l);
            }
        }
        for (int[] value : map.values()) {
            if (value[0] >= p && value[1] >= q)
                count++;
        }
        System.out.println(count);

    }
    /**
     * 5 2 2
     * 1 1 2 3 2
     * 3 5 4 5 4
     * 1 2 1 1 2
     *
     * 3
     */
}
